<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>FID Demo</title>
  </head>
  <body>
    <h2>FID Demo</h2>
    <input type="text" />
    <button onclick="btnClick()">click me</button>
    <a href="#ufo">click a link</a>
    <select>
      <option>1</option>
      <option>2</option>
      <option>3</option>
    </select>
    <script>
      function btnClick() {
        console.log("btnClick");
      }
      setTimeout(() => {
        for (let index = 0; index < 1000000000; index++) {}
        console.log("for done");
      }, 1000);
      setTimeout(() => {
        for (let index = 0; index < 1000000000; index++) {}
        console.log("for done");
      }, 3000);

      for (let index = 0; index < 2000000000; index++) {}

      new PerformanceObserver((entryList) => {
        for (const entry of entryList.getEntries()) {
          const delay = entry.processingStart - entry.startTime;
          console.log("FID candidate:", delay, entry);
        }
      }).observe({ type: "first-input", buffered: true });
    </script>
  </body>
</html>
